package com.ruoyi.common.mqtt;

/**
 * @Program: miaomiaokaituan
 * @ClassName: Sender
 * @author: zhouzihao
 * @date: 2024年11月4日, 0004 上午 11:30
 * @version: 1.0.0
 * @Description:
 * @Time： 2024-11-04 11:30
 */

//import com.ruoyi.common.mqtt.RabbitMQConfig;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.rabbit.connection.CorrelationData;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;

//https://www.cnblogs.com/bigdataZJ/p/springboot-rabbitmq.html
//@Slf4j
//@Component
public class ImmediateSender {

//    @Autowired
//    private RabbitTemplate rabbitTemplate;
//
//    public void sendMsg(String msg, int delayTime) {
//        log.info("发送延迟消息：{} ,延迟时间: {}", msg, delayTime);
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        this.rabbitTemplate.convertAndSend(RabbitMQConfig.DEAD_LETTER_EXCHANGE, RabbitMQConfig.DELAY_ROUTING_KEY, msg, message -> {
//            message.getMessageProperties().setExpiration(delayTime + "");
//            log.info(sdf.format(new Date()) + " Delay sent.");
//            return message;
//        });
//    }
}
